cmake_minimum_required(VERSION 3.16)
project(gallery LANGUAGES CXX)

set(CMAKE_AUTOMOC ON)

if(NOT DEFINED INSTALL_EXAMPLESDIR)
    set(INSTALL_EXAMPLESDIR "examples")
endif()

set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/gallery")

find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets SerialPort AxContainer Network)

qt6_wrap_ui(ui_FILES mainwindow.ui register.ui)

include_directories(out/build/x64-Debug qt_aes)

qt_add_executable(gallery
    main.cpp
    registerwindow.cpp registerwindow.h
    mainwindow.cpp mainwindow.h
    SerialPort.cpp SerialPort.h
    AreaIdentify.cpp AreaIdentify.h
    SearchTable.cpp SearchTable.h
    PhaseIdentify.cpp PhaseIdentify.h
    public.cpp public.h
    qt_aes/qaesencryption.cpp qt_aes/qaesencryption.h qt_aes/aesni-enc-cbc.h qt_aes/aesni-enc-ecb.h qt_aes/aesni-key-exp.h
    easylogging++.cc
    ${ui_FILES}  
)

set_target_properties(gallery PROPERTIES
    WIN32_EXECUTABLE TRUE
    MACOSX_BUNDLE TRUE
)

target_link_libraries(gallery PUBLIC
    Qt::Core
    Qt::Gui
    Qt::Widgets
    Qt::SerialPort
    Qt::AxContainer
    Qt::Network
)

install(TARGETS gallery
    RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
    BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
    LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
)

add_subdirectory(management) 
add_subdirectory(unit_test)


